<!--
 * @Author: zy
 * @Date: 2022-06-10 16:06:51
 * @LastEditTime: 2022-07-26 19:07:00
 * @Description: 意见反馈
-->
<template>
  <view>

    <view class="cu-form-group align-start">
      <view class="title">反馈</view>
      <textarea maxlength="255" v-model="params.content" placeholder="填写反馈内容（欢迎吐槽）"></textarea>
    </view>
    <view class="upload-imgs mt16">
      <xfImageUpload @fileUrls="setFileUrls" />
    </view>

    <view class="btn-bottom">
      <u-button type="success" @click="onConfirm">提交</u-button>
    </view>
  </view>
</template>

<script>
  import xfImageUpload from '@/components/xf-image-upload/xf-image-upload'
  export default {
    components: {
      xfImageUpload
    },
    data() {
      return {
        params: {
          content: '',
          imgs: ''
        },


      }
    },
    methods: {
      setFileUrls(urls) {
        this.params.imgs = urls
      },
      async onConfirm() {
        let obj = this.$xf.getTrimParams(this.params)
        if (obj.content && obj.content.length > 0) {
          let res = await this.$api.addFeedback(obj)
          this.$xf.resultHandler('提交成功', () => {
            uni.navigateBack()
          }, true)
        } else {
          this.$xf.toast('请填写反馈内容')
        }
      }
    }
  }

</script>

<style lang="scss" scoped>
  .upload-imgs {
    background: $bg-color-white;
    padding: 8rpx $page-row-spacing 30rpx;

    .title {
      margin-bottom: 21rpx;
    }
  }

  .btn-bottom {
    padding: 80rpx 40rpx 60rpx;
  }

</style>
